#@adminLayout() #define main()

<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="config-form">
                <div class="select-list">
                    <ul>
                        <li>
                            菜单名称：<input type="text" name="name"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<script type="text/javascript">
    var prefix ="#(ctx)/menu_select";

    $(function() {
        var options = {
            url: prefix + "/list",
            uniqueId: "id",
            showSearch: false,
            showRefresh: false,
            showColumns: false,
            showToggle: false,
            modalName: "菜单",
            columns: [{
                checkbox: true
            },
                {
                    field: 'cname',
                    title: '菜单名称',
                    formatter: function(value, row, index) {
                        var actions = [];
                        //actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a href="javascript:void(0)" onclick="openTab(\'' + row.cname + '\',\'' + row.cprg + '\')">'+row.cname+'</a>');
                        return actions.join('');
                    }
                },
                {
                    field: 'parentname',
                    title: '父级菜单'
                }]
        };
        $.table.init(options);
    });
    
    function getIds()
    {
    	var rows = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId);
		return rows.join() ;
    }
    
    function openTab(cname,cprg)
    {
    	$.modal.openTab(cname,"#(ctx)/"+cprg);
    	
    	window.parent.closeModal();
    	
    }
</script>
</body>
#end